package com.sinogrand.elevator.utils

/**
 * 应用常量定义
 * 用于存放各种枚举值和常量
 */
object Constants {
    
    // ==================== 项目相关常量 ====================
    
    /**
     * 项目状态枚举
     */
    object ProjectStatus {
        const val DELETED = 0          // 删除
        const val CONTRACT_PENDING = 1 // 合同审批中
        const val DISABLED = 2         // 已禁用
        const val PROCESSING = 3       // 进行中
        const val ARCHIVE_PENDING = 4  // 待归档
        const val ARCHIVED = 5         // 已归档
        const val MAINTENANCE = 6      // 维保中，应付验收临时添加
        
        fun getStatusDescription(status: Int): String {
            return when (status) {
                DELETED -> "删除"
                CONTRACT_PENDING -> "合同审批中"
                DISABLED -> "已禁用"
                PROCESSING -> "进行中"
                ARCHIVE_PENDING -> "待归档"
                ARCHIVED -> "已归档"
                MAINTENANCE -> "维保中"
                else -> "未知状态"
            }
        }
    }
    
    /**
     * 项目类型枚举
     */
    object ProjectType {
        const val INSTALL = 1     // 安装项目
        const val MAINTENANCE = 2 // 维保项目
        
        fun getTypeDescription(type: Int): String {
            return when (type) {
                INSTALL -> "安装项目"
                MAINTENANCE -> "维保项目"
                else -> "未知类型"
            }
        }
    }
    
    // ==================== 电梯相关常量 ====================
    
    /**
     * 电梯类型枚举
     */
    object ElevatorType {
        const val WITH_LIFT_WELL = 1    // 有电梯井
        const val WITHOUT_LIFT_WELL = 2 // 无电梯井
        const val HANDRAIL_LIFT = 3     // 扶手电梯
        
        fun getTypeDescription(type: Int): String {
            return when (type) {
                WITH_LIFT_WELL -> "有电梯井"
                WITHOUT_LIFT_WELL -> "无电梯井"
                HANDRAIL_LIFT -> "扶手电梯"
                else -> "未知类型"
            }
        }
    }
    
    /**
     * 电梯状态枚举
     */
    object ElevatorStatus {
        const val DELETED = 0                 // 删除
        const val CONTRACT_PENDING = 1        // 合同审批中
        const val DISABLED = 2                // 已禁用
        const val WAITING_ALLOCATION = 3      // 待分配
        const val ALLOCATION_PENDING = 4      // 分配审核中
        const val WAITING_START = 5           // 待开工
        const val SAMPLE_DRAWING = 11         // 放样中
        const val SLOW_CAR_DEBUGGING = 12     // 慢车调试
        const val TRACK_DOOR_INSTALLATION = 13 // 导轨厅门安装
        const val FAST_CAR_DEBUGGING = 14     // 快车调试
        const val ACCEPTANCE = 15             // 验收中
        const val TRANSFER = 16               // 移交中
        const val ARCHIVE_PENDING = 20        // 待归档
        const val ARCHIVED = 21               // 已归档
        
        fun getStatusDescription(status: Int): String {
            return when (status) {
                DELETED -> "删除"
                CONTRACT_PENDING -> "合同审批中"
                DISABLED -> "已禁用"
                WAITING_ALLOCATION -> "待分配"
                ALLOCATION_PENDING -> "分配审核中"
                WAITING_START -> "待开工"
                SAMPLE_DRAWING -> "放样中"
                SLOW_CAR_DEBUGGING -> "慢车调试"
                TRACK_DOOR_INSTALLATION -> "导轨厅门安装"
                FAST_CAR_DEBUGGING -> "快车调试"
                ACCEPTANCE -> "验收中"
                TRANSFER -> "移交中"
                ARCHIVE_PENDING -> "待归档"
                ARCHIVED -> "已归档"
                else -> "未知状态"
            }
        }
    }
    
    // ==================== 审批相关常量 ====================
    
    /**
     * 审批单模版类型枚举
     */
    object ApprovalTemplateType {
        const val INSTALL_CONTRACT = "INSTALL_CONTRACT"                                                                    // 安装合同
        const val SALES_CONTRACT = "SALES_CONTRACT"                                                                        // 销售合同
        const val CONTRACT_UPDATE = "CONTRACT_UPDATE"                                                                      // 合同变更
        const val STUDY = "STUDY"                                                                                          // 学习资料
        const val EQUIPMENT_APPLY = "EQUIPMENT_APPLY"                                                                      // 申请劳保用品
        const val EQUIPMENT_ISSUE = "EQUIPMENT_ISSUE"                                                                      // 发放劳保用品
        const val PROJECT_APPLY_JOIN = "PROJECT_APPLY_JOIN"                                                                // 申请加入项目
        const val PROJECT_DELETE_MEMBER = "PROJECT_DELETE_MEMBER"                                                          // 删除安装组员
        const val SUBMIT_CERTIFICATE = "SUBMIT_CERTIFICATE"                                                                // 提交证书
        const val ELEVATOR_FILING = "ELEVATOR_FILING"                                                                      // 开工审批备案
        const val ELEVATOR_MONITORING = "ELEVATOR_MONITORING"                                                              // 电梯监检协议
        const val ELEVATOR_LOG_INSPECTION = "ELEVATOR_LOG_INSPECTION"                                                      // 电梯安全巡视
        const val ELEVATOR_PROTECTION = "ELEVATOR_PROTECTION"                                                              // 电梯防护照片
        const val ELEVATOR_LOFTING = "ELEVATOR_LOFTING"                                                                    // 电梯放样照片
        const val ELEVATOR_LOG_INSTALL = "ELEVATOR_LOG_INSTALL"                                                            // 电梯安装日志
        const val ELEVATOR_SLOW_CAR_DEBUGGING = "ELEVATOR_SLOW_CAR_DEBUGGING"                                              // 电梯慢车调试
        const val ELEVATOR_TRACK_DOOR_INSTALLATION = "ELEVATOR_TRACK_DOOR_INSTALLATION"                                    // 电梯导轨厅门安装
        const val ELEVATOR_FAST_CAR_DEBUGGING = "ELEVATOR_FAST_CAR_DEBUGGING"                                              // 电梯快车调试
        const val ELEVATOR_ACCEPTANCE = "ELEVATOR_ACCEPTANCE"                                                              // 电梯验收
        const val ELEVATOR_LOG_OVERDUE = "ELEVATOR_LOG_OVERDUE"                                                            // 电梯超期说明
        const val ELEVATOR_TRANSFER = "ELEVATOR_TRANSFER"                                                                  // 电梯移交
        const val ELEVATOR_ARRIVAL = "ELEVATOR_ARRIVAL"                                                                    // 电梯到货单
        const val ELEVATOR_UNPACKING = "ELEVATOR_UNPACKING"                                                                // 电梯开箱确认表
        const val CONTRACT_OUTSOURCE = "CONTRACT_OUTSOURCE"                                                                // 外包合同
        const val CONTRACT_PURCHASE = "CONTRACT_PURCHASE"                                                                  // 采购合同
        const val CONTRACT_OTHER = "CONTRACT_OTHER"                                                                        // 其他合同
        const val ELEVATOR_LOFTING_PAYMENT = "ELEVATOR_LOFTING_PAYMENT"                                                    // 电梯放样打款
        const val ELEVATOR_SLOW_CAR_DEBUGGING_PAYMENT = "ELEVATOR_SLOW_CAR_DEBUGGING_PAYMENT"                              // 电梯慢车调试打款
        const val ELEVATOR_TRACK_DOOR_INSTALLATION_PAYMENT = "ELEVATOR_TRACK_DOOR_INSTALLATION_PAYMENT"                    // 电梯导轨厅门安装打款
        const val ELEVATOR_FAST_CAR_DEBUGGING_PAYMENT = "ELEVATOR_FAST_CAR_DEBUGGING_PAYMENT"                              // 电梯快车调试打款
        const val ELEVATOR_ACCEPTANCE_PAYMENT = "ELEVATOR_ACCEPTANCE_PAYMENT"                                              // 电梯验收打款
        const val ELEVATOR_TRANSFER_PAYMENT = "ELEVATOR_TRANSFER_PAYMENT"                                                  // 电梯移交打款
        
        fun getTypeDescription(type: String): String {
            return when (type) {
                INSTALL_CONTRACT -> "安装合同"
                SALES_CONTRACT -> "销售合同"
                CONTRACT_UPDATE -> "合同变更"
                STUDY -> "学习资料"
                EQUIPMENT_APPLY -> "申请劳保用品"
                EQUIPMENT_ISSUE -> "发放劳保用品"
                PROJECT_APPLY_JOIN -> "申请加入项目"
                PROJECT_DELETE_MEMBER -> "删除安装组员"
                SUBMIT_CERTIFICATE -> "提交证书"
                ELEVATOR_FILING -> "开工审批备案"
                ELEVATOR_MONITORING -> "电梯监检协议"
                ELEVATOR_LOG_INSPECTION -> "电梯安全巡视"
                ELEVATOR_PROTECTION -> "电梯防护照片"
                ELEVATOR_LOFTING -> "电梯放样照片"
                ELEVATOR_LOG_INSTALL -> "电梯安装日志"
                ELEVATOR_SLOW_CAR_DEBUGGING -> "电梯慢车调试"
                ELEVATOR_TRACK_DOOR_INSTALLATION -> "电梯导轨厅门安装"
                ELEVATOR_FAST_CAR_DEBUGGING -> "电梯快车调试"
                ELEVATOR_ACCEPTANCE -> "电梯验收"
                ELEVATOR_LOG_OVERDUE -> "电梯超期说明"
                ELEVATOR_TRANSFER -> "电梯移交"
                ELEVATOR_ARRIVAL -> "电梯到货单"
                ELEVATOR_UNPACKING -> "电梯开箱确认表"
                CONTRACT_OUTSOURCE -> "外包合同"
                CONTRACT_PURCHASE -> "采购合同"
                CONTRACT_OTHER -> "其他合同"
                ELEVATOR_LOFTING_PAYMENT -> "电梯放样打款"
                ELEVATOR_SLOW_CAR_DEBUGGING_PAYMENT -> "电梯慢车调试打款"
                ELEVATOR_TRACK_DOOR_INSTALLATION_PAYMENT -> "电梯导轨厅门安装打款"
                ELEVATOR_FAST_CAR_DEBUGGING_PAYMENT -> "电梯快车调试打款"
                ELEVATOR_ACCEPTANCE_PAYMENT -> "电梯验收打款"
                ELEVATOR_TRANSFER_PAYMENT -> "电梯移交打款"
                else -> "未知类型"
            }
        }
        
        /**
         * 根据审批单模版类型返回对应的小写key
         */
        fun getTypeKey(type: String): String {
            return when (type) {
                ELEVATOR_PROTECTION -> "protection"
                ELEVATOR_LOFTING -> "lofting"
                ELEVATOR_LOFTING_PAYMENT -> "lofting_payment"
                ELEVATOR_SLOW_CAR_DEBUGGING -> "slow_car_debugging"
                ELEVATOR_SLOW_CAR_DEBUGGING_PAYMENT -> "slow_car_debugging_payment"
                ELEVATOR_TRACK_DOOR_INSTALLATION -> "track_door_installation"
                ELEVATOR_TRACK_DOOR_INSTALLATION_PAYMENT -> "track_door_installation_payment"
                ELEVATOR_FAST_CAR_DEBUGGING -> "fast_car_debugging"
                ELEVATOR_FAST_CAR_DEBUGGING_PAYMENT -> "fast_car_debugging_payment"
                ELEVATOR_ACCEPTANCE -> "acceptance"
                ELEVATOR_ACCEPTANCE_PAYMENT -> "acceptance_payment"
                ELEVATOR_TRANSFER -> "transfer"
                ELEVATOR_TRANSFER_PAYMENT -> "transfer_payment"
                ELEVATOR_ARRIVAL -> "arrival"
                ELEVATOR_UNPACKING -> "unpacking"
                else -> ""
            }
        }
    }
    
    // ==================== 成员相关常量 ====================
    
    /**
     * 项目成员状态枚举
     */
    object ProjectSubUserStatus {
        const val DELETED = 0  // 删除
        const val ENABLED = 1  // 正常
        const val DISABLED = 2 // 禁用
        const val PENDING = 3  // 待审核
        const val REJECTED = 4 // 拒绝
        
        fun getStatusDescription(status: Int): String {
            return when (status) {
                DELETED -> "删除"
                ENABLED -> "正常"
                DISABLED -> "禁用"
                PENDING -> "待审核"
                REJECTED -> "拒绝"
                else -> "未知状态"
            }
        }
    }
}
